<?php


namespace app\api\controller\v1;


use app\common\validate\api\LoginValidate;
use think\exception\ValidateException;
use think\Log;
use think\Validate;
use think\Request;

class Login
{
    /**
     * @api {get}  api/v1.Login/login 登录
     * @apiVersion 0.1.0
     * @apiName login
     * @apiGroup 用户中心
     *
     * @apiParam {string} mobile 手机号.
     * @apiParam {string} code 验证码.
     *
     * @apiSuccess {String} admin_admin_id 用户id.
     * @apiSuccess {String} admin_token  用户token.
     * @apiSampleRequest api/v1.Login/login
     * @apiSuccessExample Success-Response:
     *     HTTP/1.1 200 OK
     *     {
     *           code: 200,
     *           msg: "登录成功",
     *           data: {
     *           admin_admin_id: 2,
     *           admin_token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJsampBZG1pbiIsImlhdCI6MTYyOTE2Nzg2OCwibmJmIjoxNjI5MTY3ODY4LCJleHAiOjE2MjkyMTEwNjgsImRhdGEiOnsiYWRtaW5fYWRtaW5faWQiOjIsImxvZ2luX3RpbWUiOiIyMDIxLTA4LTE3IDEwOjM3OjQ4IiwibG9naW5faXAiOiIxMjcuMC4wLjEifX0.QhnW5Y-3QiQ1tJBkpIHkhIcBr6JplHaI_byvZxN9k8E"
     *               }
     *           }
     *
     * @apiError UserNotFound The id of the User was not found.
     *
     * @apiErrorExample Error-Response:
     *     HTTP/1.1 404 Not Found
     *     {
     *       "error": "UserNotFound"
     *     }
     */

   public function login()
   {
       $userInfo = \think\facade\Request::param();
      // $loginValidate = new LoginValidate();
       return json($userInfo);
       //echo "测试git提交同步";

       validate(LoginValidate::class)->scene('add')->check($userInfo);
     /*  try {
           validate(app\validate\User::class)
               ->scene('edit')
               ->check($data);
       } catch (ValidateException $e) {
           // 验证失败 输出错误信息
           dump($e->getError());
       }*/

   }

    /**
     * @api {get}  api/v1.Login/reg 注册
     * @apiVersion 0.1.0
     * @apiName reg
     * @apiGroup 用户中心
     *
     * @apiParam {string} mobile 手机号.
     * @apiParam {string} code 验证码.
     *
     * @apiSuccess {String} admin_admin_id 用户id.
     * @apiSuccess {String} admin_token  用户token.
     * @apiSampleRequest api/v1.Login/reg
     * @apiSuccessExample Success-Response:
     *     HTTP/1.1 200 OK
     *     {
     *           code: 200,
     *           msg: "登录成功",
     *           data: {
     *           admin_admin_id: 2,
     *           admin_token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJsampBZG1pbiIsImlhdCI6MTYyOTE2Nzg2OCwibmJmIjoxNjI5MTY3ODY4LCJleHAiOjE2MjkyMTEwNjgsImRhdGEiOnsiYWRtaW5fYWRtaW5faWQiOjIsImxvZ2luX3RpbWUiOiIyMDIxLTA4LTE3IDEwOjM3OjQ4IiwibG9naW5faXAiOiIxMjcuMC4wLjEifX0.QhnW5Y-3QiQ1tJBkpIHkhIcBr6JplHaI_byvZxN9k8E"
     *               }
     *           }
     *
     * @apiError UserNotFound The id of the User was not found.
     *
     * @apiErrorExample Error-Response:
     *     HTTP/1.1 404 Not Found
     *     {
     *       "error": "UserNotFound"
     *     }
     */
   public function reg()
   {
       $userInfo = \think\facade\Request::param();
       var_dump($userInfo);die();
   }



}
